<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- 元素中的属性称为attribute -->
  <!-- 标准的attribute在对应的对象模型中都有对应的property -->
  <div id="abc" class="box" title="标题" age="18" height="1.88">
    我是box
  </div>

  <input type="checkbox" checked>

  账号: <input type="text" class="account">
  <button class="btn">设置值</button>

  <script>
    // 对象中的属性称为 property
    var obj = { name: 'why' }

    var boxEl = document.querySelector('.box')
    // abc 标题 box undefined undefined
    console.log(
      boxEl.id,
      boxEl.title,
      boxEl.className,
      boxEl.age,
      boxEl.height,
    )

    var inputEl = document.querySelector('input')
    console.log(inputEl.checked, typeof inputEl.checked,) // true 'boolean'

    boxEl.id = 'aaaaa'
    boxEl.setAttribute('title', '哈哈哈')
    console.log(boxEl.getAttribute('id'), boxEl.title) //aaaaa 哈哈哈

    var accountInputEl = document.querySelector('.account')

    var btnEl = document.querySelector('.btn')
    btnEl.onclick = function () {
      accountInputEl.value = "coderwhy"
      // accountInputEl.setAttribute("value", "kobe")
    }


  </script>

</body>

</html>